package com.jackson.spring.beandemo.factory;

import java.util.HashMap;
import java.util.Map;

/**
 * 静态工厂方法：直接调用某个类的静态方法，就可以返回bean实例 
 * @author jackson
 *
 */
public class StaticBeanFactory {

	private static Map<String,Car> cars = new HashMap<String,Car>();
	
	static{
		cars.put("aodi",new Car("red", 3000000, 150, "aodi"));
		cars.put("baoma",new Car("green", 2000000, 150, "baoma"));
		cars.put("ford",new Car("blue", 5000000, 190, "ford"));
	}
	
	public static Car getCar(String name){
		return cars.get(name);
	}
}
